package com.huantai.common.dto;

import java.io.Serializable;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * RESTful API 响应基类
 * 
 * @author Ma Chao
 * @version 2019年5月22日 下午5:26:09
 * @param <T>
 */
@Data
@ApiModel(description = "RESTful API 响应基类")
public class BaseResponse<T> implements Serializable {
    private static final long serialVersionUID = 1L;
    /** 响应代码 */
    @ApiModelProperty(notes = "响应代码", dataType = "String", required = true, example = "200")
    private String code;

    /** 响应消息 */
    @ApiModelProperty(notes = "响应消息", dataType = "String", required = true, example = "接口调用成功！")
    private String message;

    /** 响应结果 */
    @ApiModelProperty(notes = "响应结果")
    private T result; // NOSONAR

    public BaseResponse(T result) {
        this.result = result;
    }

    public BaseResponse(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public BaseResponse() {

    }
}
